static int model_is_rgba (const Babl *model)
{
const Babl *RGBA = babl_model_from_id (BABL_RGBA);
- if (model == RGBA || model->model.data == RGBA)
+ if (model == RGBA || model->model.model == RGBA)
return 1;
return 0;
}
BablSpace *space = user_data;
if ((conv->source->class_type == BABL_FORMAT) &&
- (conv->destination->class_type == BABL_FORMAT))
+ (conv->destination->class_type == BABL_FORMAT) &&
+ (!babl_format_is_palette (conv->source)) &&
+ (!babl_format_is_palette (conv->destination)))
{
if ((conv->source->format.space == (void*)babl_space ("sRGB")) &&
(conv->destination->format.space == babl_space ("sRGB")))
if (BABL (source)->class_type == BABL_MODEL)
{
- const Babl *srgb_source = BABL (source)->model.data ? BABL (source)->model.data:source;
- const Babl *srgb_destination = BABL (destination)->model.data ? BABL (destination)->model.data:destination;
+ const Babl *srgb_source = BABL (source)->model.model ? BABL (source)->model.model:source;
+ const Babl *srgb_destination = BABL (destination)->model.model ? BABL (destination)->model.model:destination;
Babl *reference = babl_conversion_find (srgb_source, srgb_destination);
/* when conversions are sought between models, with non-sRGB chromaticities,
babl->model.components = components;
babl->model.space = space;
babl->model.data = NULL;
+ babl->model.model = NULL;
strcpy (babl->instance.name, name);
memcpy (babl->model.component, component, sizeof (BablComponent *) * components);
{
Babl *ret;
int i;
+ assert (BABL_IS_BABL (model));
if (model->model.space == space)
return (void*)model;
+ assert (BABL_IS_BABL (model));
+
/* get back to the sRGB model if we are in a COW clone of it */
- if (model->model.data)
- model = (void*)model->model.data;
+ if (model->model.model)
+ model = (void*)model->model.model;
+
+ assert (BABL_IS_BABL (model));
for (i = 0; i < babl_n_remodels; i++)
{
- if (babl_remodels[i]->model.data == model &&
+ if (babl_remodels[i]->model.model == model &&
babl_remodels[i]->model.space == space)
return babl_remodels[i];
}
ret = babl_calloc (sizeof (BablModel), 1);
memcpy (ret, model, sizeof (BablModel));
ret->model.space = space;
- ret->model.data = (void*)model; /* use the data as a backpointer to original model */
+ ret->model.model = (void*)model; /* use the data as a backpointer to original model */
return babl_remodels[babl_n_remodels++] = ret;
return (Babl*)ret;
}
BablComponent **component;
BablType **type; /*< must be doubles,
used here for convenience in code */
- void *data; /* used for palette - and maybe back pointer
- to actual model?
- */
+ void *data; /* user-data, used for palette */
+ void *model; /* back pointer to model with sRGB space */
const Babl *space;
} BablModel;